package com.riaevolution.components.breadcrumb {
	import flash.text.TextLineMetrics;

	import mx.controls.Button;
	import mx.core.mx_internal;
	use namespace mx_internal;

	/**
	 * Use this button for nice design link bread crumb item.
	 *
	 * <br /><b>Luciano bustos</b> <a href="mailto:luchyx&#64;riaevolution.com">luchyx&#64;riaevolution.com</a><br /><a href="http://www.riaevolution.com">www.riaevolution.com</a>
	 */
	public class BreadCrumbButton extends Button {

		/**
		 * hold a reference to know tell that this button is the firstOn the navBar
		 * If you use this button alone you can set this property too.
		 *
		 */
		public var firstChild:Boolean = false;

		/**
		 * Flah que me indica si este boton usa texto HTML en el label
		 */
		public var useHtml:Boolean = false;

		public function BreadCrumbButton() {
			super();

			setStyle("upSkin", BreadCrumbButtonSkin);
			setStyle("downSkin", BreadCrumbButtonSkin);
			setStyle("overSkin", BreadCrumbButtonSkin);
			setStyle("disabledSkin", BreadCrumbButtonSkin);
		}

		override protected function updateDisplayList(uw:Number, uh:Number):void {
			super.updateDisplayList(uw, uh);

			if (useHtml) {
				textField.htmlText = label;
			}
		}

		/**
		 * This overrited function return TextLineMetrics based on htmlLabel property.
		 * If htmlLabel is not null, its return TextLineMetrics for htmlLabel.
		 * Otherwiset its return TextLineMetrics for label.
		 */
		override public function measureText(text:String):TextLineMetrics {
			if (useHtml) {
				return super.measureHTMLText(text);
			}
			return super.measureText(text);
		}
	}
}



